package com.yrot.admin.excel;

import com.alibaba.excel.read.context.AnalysisContext;
import com.alibaba.excel.read.event.AnalysisEventListener;
import com.yrot.admin.entity.SysQuestions;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/* 解析监听器，
* 每解析一行会回调invoke()方法。
* 整个excel解析结束会执行doAfterAllAnalysed()方法
*
* @author hemin
* @date 2019/04/09
*/
public class SysQuestionsListener extends AnalysisEventListener {

    private List<SysQuestions> datas = new ArrayList<SysQuestions>();

    public SysQuestionsListener() {
        super();
    }

    @Override
    public void invoke(Object o, AnalysisContext analysisContext) {
        SysQuestions sysQuestions = new SysQuestions();
        BeanUtils.copyProperties(o,sysQuestions);
        datas.add(sysQuestions);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
